package com.itfenghuang.day15_作业;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class A01_服务端 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(11122);
        Socket at = ss.accept();
        InputStream is = at.getInputStream();
        byte[] bs = new byte[1024];
        int len;
        at.getInputStream();
        while ((len=is.read(bs))!=-1){
            System.out.println(new String(bs,0,len));
        }
        OutputStream os = at.getOutputStream();
        os.write("就怕少妇三十岁".getBytes());
        ss.close();
        os.close();
    }
}
